function se (name) {
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  decodeURI(r[2]); return null;
}
$.ajax({
    url:'/api/product/product_detail',
    data: {
        id: se('id')
    },
    type: 'post',
    dataType: 'json',
    success: function(res) {
        if(res.code === 0){
            imgList = res.object.product.img.split(',').map(function (img) {
                return res.object.domin + img
            })
            $('#top-img img').attr('src', imgList[0])
            var filterList = ['id', 'name', 'price', 'remark']
            filterList.forEach(function (key) {
                $('#' + key).html(res.object.product[key])
            })
            imgList.forEach(function (img, index) {
                console.log(index)
                if(index) {
                    var i = document.createElement('img')
                    i.src = img
                    $(i).appendTo($('#bottom-img'))
                }
            })
        }
    }
})